package com.hex.liyue.usermodule.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.hex.liyue.R;
import com.hex.liyue.commonmodule.activity.BaseActivity;
import com.hex.liyue.commonmodule.utils.StatusBarCompatUtils;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by $cmm on 2016/6/23.
 * <p/>
 * 个性签名界面
 */
public class NewSignatureActivity extends BaseActivity {
    @Bind(R.id.iv_toobar_back)
    ImageView ivToobarBack;
    @Bind(R.id.tv_toobar_title)
    TextView tvToobarTitle;
    @Bind(R.id.et_signature_enter)
    EditText etSignatureEnter;

    @Override
    protected void bindPresenter() {

    }

    @Override
    protected void initData(Bundle extras) {
        etSignatureEnter.setText(getIntent().getStringExtra("signature"));
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_new_signature;
    }

    @Override
    protected void initToolbar() {
        StatusBarCompatUtils.compat(this);
        ivToobarBack.setVisibility(View.VISIBLE);
        tvToobarTitle.setVisibility(View.VISIBLE);
        tvToobarTitle.setText("个性签名");
    }

    @OnClick({
            R.id.iv_toobar_back,
            R.id.bt_signature})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_toobar_back://返回
                onBackPressed();
                break;
            case R.id.bt_signature://确定
                String signature = etSignatureEnter.getText().toString();
                if (!TextUtils.isEmpty(signature)) {
                    PersonEditActivity.signature = signature;
                    setResult(RESULT_OK);
                    finish();
                } else {
                    showToast(this, "请输入签名");
                }
                break;
        }
    }
}
